﻿using System.Linq;
using System.Text;
using KamLib;

namespace Ext.Net.UIS
{

    public class FieldRow : Ext.Net.Container, ITermBox
    {
        public new Context Context { get; set; }
        public string Name { get; set; }
        public Term Term { get; set; }
        public TermNode ParentTermNode { get; set; }
        public TermNode TermNode { get; set; }

        public bool ControlsCreated { get; set; }
        public void CreateControls(UisCreateControlArgs e)
        {
            Layout = "HBoxLayout";

            this.UisGetTermNode();
            if (TermNode == null) return;

            TermNode.ApplyToContainer(this);


            foreach (var item in TermNode.Skip(1))
            {
                var title = item.Title.Name;
                if (title.yes())
                    item.LabelLength = title.Length;
            }
        }
    }

}
